<template>
  <div class="wrapper">
    <el-input
      v-if="typeof value !== 'undefined'"
      placeholder="请输入内容"
      class="input"
      :value="value"
      @input="(val) => $emit('input', val)"
    >
      <el-button
        :loading="loading"
        slot="append"
        icon="el-icon-search"
        @click="$emit('search')"
      ></el-button>
    </el-input>
    <el-button @click="$emit('click')" type="primary" v-if="$slots.default">
      <slot></slot>
    </el-button>
  </div>
</template>

<script>
export default {
  name: "Search",
  props: {
    /**
     * 搜索区的值
     */
    value: String,
    /**
     * loading
     */
    loading: Boolean,
  },

  mounted() {},
  methods: {},
};
</script>

<style scoped lang="scss">
.wrapper {
  margin-bottom: 15px;
}
.input {
  width: 300px;
  margin-right: 20px;
}
</style>
